<?php namespace App\Exceptions;

use Exception;

class NotFoundException extends Exception
{
    const UserNotFound =0x00;
    const UserInfoNotFound = 0x01;
    const ImageNotFound = 0x02;
    const FileNotFound = 0x03;
    const UrlNotFound = 0x04;
    const AddressNotFound = 0x05;
    const paramNotFound=0x06;
    const ClassifyNotFound = 0x07;
    const CommodityNotFound = 0x08;
    const PropertyNotFound = 0x09;
    const OrderNotFound = 0x10;
    const AppealNotFound = 0x11;
    const AfterSaleNotFound = 0x12;
    const ParentPartNotFound = 0x13;
    const DataNotFound = 0x14;
    const DesignNotFound = 0x15;
    const DesignPartsNotFound = 0x16;
    const CouponNotFound    = 0x0a;
    const InviteCodeNotFound    = 0x0b;
    const PayCodeNotFound    = 0x0c;
    const DesignOrdersNotFound = 0x0d;
    const DesignServiceNotFound = 0x0e;
    public function __construct($code,array $data = [],Exception $previous = null)
    {
        switch($code){
            case self::UserNotFound:
                $message = trans('用户不存在',[]);
                break;
            case self::UserInfoNotFound:
                $message = trans('用户信息不存在',[]);
                break;
            case self::ImageNotFound:
                $message = trans('图片不存在',[]);
                break;
            case self::FileNotFound:
                $message = trans('文件不存在',[]);
                break;
            case self::UrlNotFound:
                $message = trans('链接不存在',[]);
                break;
            case self::AddressNotFound:
                $message = trans('收货地址不存在',[]);
                break;
            case self::paramNotFound:
                $message = trans('未搜索到输入的参数',[]);
                break;
            case self::ClassifyNotFound:
                $message = trans('分类信息未找到',[]);
                break;
            case self::CommodityNotFound:
                $message = trans('该商品不存在',[]);
                break;
            case self::PropertyNotFound:
                $message = trans('属性未找到',[]);
                break;
            case self::OrderNotFound:
                $message = trans('订单不存在',[]);
                break;
            case self::AppealNotFound:
                $message = trans('投诉订单不存在',[]);
                break;
            case self::AfterSaleNotFound:
                $message = trans('售后订单不存在',[]);
                break;
            case self::ParentPartNotFound:
                $message = trans('父级部件未找到',[]);
                break;
            case self::DesignNotFound:
                $message = trans('设计作品不存在',[]);
                break;
            case self::DesignPartsNotFound:
                $message = trans('设计作品部件不存在',[]);
                break;
            case self::DataNotFound:
                $message = trans('数据未找到',[]);
                break;
            case self::CouponNotFound:
                $message = trans('优惠券不存在',[]);
                break;
            case self::InviteCodeNotFound:
                $message = trans('邀请码不存在',[]);
                break;
            case self::PayCodeNotFound:
                $message = trans('支付码不存在或已过期',[]);
                break;
            case self::DesignOrdersNotFound:
                $message = trans('设计订单不存在',[]);
                break;
            case self::DesignServiceNotFound:
                $message = trans('设计服务不存在',[]);
                break;
            default:
                $message = trans('general.unknown_exception');
                break;
        }

        parent::__construct($message,$code,$previous);
    }
}